package org.feng.framework.file;

import org.feng.enums.Server;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author feng
 */
@Component
public class LogstashFilter implements Filter {

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        MDC.put("appName", Server.system.name());
        filterChain.doFilter(servletRequest, servletResponse);
        MDC.clear();
    }
}
